

function say() {
    alert("LC:73. 矩阵置零");
}
say();


/**
 * @param {number[][]} matrix
 * @return {void} Do not return anything, modify matrix in-place instead.
 */
var setZeroes = function(matrix) {
    //4:17-32
    var zeroIdxs = []
    for(var i = 0; i < matrix.length; i++){
        var item = matrix[i]
        for(var j = 0; j < item.length; j++){
            if(item[j] == 0){
                zeroIdxs.push([i, j])
            }
        }
    }

    var m = matrix[0].length //行,元素个数
    var n = matrix.length //列
    for(var i = 0; i < zeroIdxs.length; i ++){
        var item = zeroIdxs[i]
        var iLine = item[0]
        for(var j = 0; j < m; j++){
            matrix[iLine][j] = 0
        }

        for(var k = 0; k < n; k++){
            matrix[k][item[1]] = 0
        }
    }
};
